# # -*- coding: UTF-8 -*-
# # Author: Damon(wuud1)
# # CreateDate:
# # Message:
# # a = '''AXLE & SUSPENSION                       '''
# # print(a.strip())
# # import os
# # img_path = '/Users/duanmengdi/Documents/nissan/nissan_data/Pictures'
# # img_list = os.listdir(img_path)
# # img_list = img_list[0:10]
# # print(img_list)
#
# # a = 'B10RS_769_A 01'
# # b = a.split('_')
# # print(b)
# # a = {"a":"b"}
# # print("b" in a)
# # a = '267A 01'
# # print(a[:3]+'_'+a[3:])
#
# # a = 'E24_165_D02'
# # l = a.split('_')
# # cid = l[0]
# # kid = l[1]
# # img_group = l[2][-2:]
# # print(cid+'_'+kid+'_'+img_group)
# # a = "88.893"
# # b = 88.356
# # print(int(float(a)))
# # print(int(b))
# from base_class import BaseClass
# import os
# #
# tools = BaseClass()
# base_path = '/Users/duanmengdi/Desktop/nissan_group_img/'
# name_list = os.listdir(base_path)
# # for name in name_list:
# # # name = ''
# #     name_ = name[:-4]
# #     md5_name = tools.get_md5(name_.encode("utf8"))
# #     new_name = md5_name+'.png'
# #     command = 'mv "{}" {}'.format(base_path+name, base_path+new_name)
# #     print(command)
# #     os.system(command)
# #     # print({name:new_name})
#
# str = '发动机'
# # print(tools.get_md5(str.encode()))
#
#
# raw = 'HB.MR18DE.(S+SL+MID) +HB.(K9K+HR16DE)'
#
# res = ['HB.MR18DE.S','HB.MR18DE.SL','HB.MR18DE.MID','HB.K9K','HB.HR16DE']
#
# raw = 'a.b.(c+d+e).h+a.(f+g)+i.j.k'
# res = ['a.b.c.h','a.b.d.h','a.b.e.h','a.f','a.g']
# raw = 'MEXICO.(35SV+35SR).CVT +GCC.CVT'
# raw = '*4S.MEXICO +*4S.35SR'
# raw = 'S.(GEN+GCC).QG16.(PE+SE).(MT+AT) +QG15'
# import re
# # def test1(raw):
# #     t = re.findall('\).*?\+', raw)
# #     if len(t)>0:
# #         for i in t:
# #             j = i.replace('+', '*')
# #             res1 = re.sub('\).*?\+', j, raw)
# #             raw = res1
# #         print(raw)
# # test1(raw)
# # def test2(raw):
# #     raw = re.sub('\).*?(\+)','*', raw)
# #     print(raw)
# # test2(raw)
# raw = 'HB.(BASE+UPPER+UPP/ISS+TECH+TECH/ISS)'
# raw = 'SC.4WD.KA24DE +SC.(QD32+ZD30DDT) +DC.2WD.YD25DDTI.ST +DC.4WD.(KA24DE+YD25DDTI) +DC.(QD32+ZD30DDT)'
# raw = 'S.(GEN+GCC).QG16.(PE+SE).(MT+AT) +QG15'
# raw = 'S.(GEN+GCC).QG16.(PE+SE).(MT+AT) +S.QG15'
# try:
#     from functools import reduce
# except :
#     import reduce
# import json
# def myfunc(lists):
#     # list all possible composition from many list, each item is a tuple.
#     # Here lists is [list1, list2, list3], return a list of [(item1,item2,item3),...]
#     # len of result list and result list.
#     total = reduce(lambda x, y: x * y, map(len, lists))
#     retList = []
#     # every item of result list.
#     for i in range(0, total):
#         step = total
#         tempItem = []
#         for l in lists:
#             step /= len(l)
#             tempItem.append(l[int(i / step % len(l))])
#         retList.append('.'.join(tempItem))
#     return retList
#
# def test3(raw):
#     '''把字符串转换成对应的条件组合,输出所有条件组合set
#     涉及变量太多,不想起名'''
#     t_l = re.findall('\(.*?\)', raw)
#     # print(t_l)
#     for t in t_l:
#         i = t.replace('+', '*')
#         # print(i)
#         raw = raw.replace(t, i)
#     # print(raw)
#     raw_l = raw.split('+')
#     # print(raw_l)
#     _l = []
#     for i in raw_l:
#         # S.(GEN*GCC).QG16.(PE*SE).(MT*AT)
#         i_k = re.findall('\(.*?\)', i)
#         # print("ik",i_k)
#         if len(i_k)>1:
#             # ['(GEN*GCC)', '(PE*SE)', '(MT*AT)']
#             l = []
#             k = [i.replace('(','').replace(')','').split('*') for i in i_k]
#             m = myfunc(k)
#             i_q = i
#             for n in i_k:
#                 i_q = i_q.replace(n, '')
#             i_q = i_q.replace(' ', '').replace('..','.')
#             for o in m:
#                 r = (i_q+'.'+o).replace(' ', '').replace('..','.').replace('..','.')
#                 _l.append(r)
#         else:
#             if not i_k:
#                 _l.append(i.replace(' ', '').replace('..','.').replace('..','.'))
#                 continue
#             i_q = i.replace(i_k[0], '').replace('..', '.')
#
#             i_l = i_k[0].replace('(', '').replace(')', '')
#             i_l = i_l.split("*")
#             for j in i_l:
#                 r = (i_q+'.'+j).replace(' ', '').replace('..','.').replace('..','.')
#                 _l.append(r)
#     # print(_l)
#     return json.dumps(_l)
#
# # res = test3(raw)
# # print(res)




















